<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>导出例子</title>
	</head>
	<body>
		<input type="button" id="export-btn" value="调用service层方法导出(模板例子.xls)" />
		<input type="button" id="export-btn-sql" value="使用sql脚本导出(模板例子2.xls)" />
		<input type="button" id="import-btn" value="调用service层导入(模板例子3.xls)" />
		<input type="button" id="import-btn-sql" value="使用sql脚本导入(模板例子3.xls)" />
		<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
		<script type="application/javascript" src="../js/jquery-2.1.0.js"></script>
		<script type="application/javascript" src="../layui/layui.js"></script>
		<script type="application/javascript" src="../js/tool.js"></script>
		<script type="application/javascript">
			$(function() {
				$("#export-btn").on("click", function() {
					$.export_file("http://localhost:9140/model/exportExcel", {modelCode: "123456789"});
				});
				$("#export-btn-sql").on("click", function() {
					$.export_file("http://localhost:9140/model/exportExcel", {modelCode: "123456788", loginName: "sanhua"});
				});
				layui.use(['upload', 'form'], function() {
					var upload = layui.upload;
					var uploadInst = upload.render({
	        			elem: "#import-btn", //绑定元素
	                    url: "http://localhost:9140/model/importExcel", //上传接口
	                    size: 10240,
	                    data: {modelCode: "123456787"},
	                    accept: "file",
	                    field: "file",
	                    done: function(result) {
                            $.layui_alert(result.message);
	                    }
	        		});
	        		
	        		upload.render({
	        			elem: "#import-btn-sql", //绑定元素
	                    url: "http://localhost:9140/model/importExcel", //上传接口
	                    size: 10240,
	                    data: {modelCode: "123456786"},
	                    accept: "file",
	                    field: "file",
	                    done: function(result) {
                            $.layui_alert(result.message);
	                    }
	        		});
				});
			});
		</script>
	</body>
</html>
